package com.huawei.lynnbit.tool.cocos.config.game;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

@Data
@Slf4j
public class PackageConfig {
    private PackageType type;
    private String certPath;
    private String keyAlias;
    private String keyPassword;
    private String profile;
    private String storeFile;
    private String storePassword;

    public boolean isValid() {
        if (Objects.isNull(type)) {
            log.error("package type cannot be blank");
            return false;
        }

        if (StringUtils.isBlank(certPath)) {
            log.error("certPath cannot be blank");
            return false;
        }

        if (StringUtils.isBlank(keyAlias)) {
            log.error("keyAlias cannot be blank");
            return false;
        }

        if (StringUtils.isBlank(keyPassword)) {
            log.error("keyPassword cannot be blank");
            return false;
        }

        if (StringUtils.isBlank(profile)) {
            log.error("profile cannot be blank");
            return false;
        }

        if (StringUtils.isBlank(storeFile)) {
            log.error("storeFile cannot be blank");
            return false;
        }

        if (StringUtils.isBlank(storePassword)) {
            log.error("storePassword cannot be blank");
            return false;
        }

        return true;
    }
}
